package com.djhu.freepartner.web.control;

import com.djhu.freepartner.core.RestRsp;
import com.djhu.freepartner.core.Status;
import com.djhu.freepartner.web.control.model.PushMsgModel;
import com.djhu.freepartner.web.service.IPushMsgService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController()
@RequestMapping("/pushmsg")
public class PushMsgControl {

    @Autowired
    private IPushMsgService pushMsgService;


    @ApiOperation("发送推送信息")
    @PostMapping("/push")
    public RestRsp pushMsg(@RequestBody PushMsgModel pushMsgModel){
        String retMsg = pushMsgService.pushMsgByToken(pushMsgModel.getTitle(),pushMsgModel.getMessage(),pushMsgModel.getToken());
        RestRsp restRsp = new RestRsp(Status.SUCCESS);
        restRsp.setData(retMsg);
        return restRsp;
    }

}
